-
Notifications
You must be signed in to change notification settings - Fork 6
DATAUP-530 Refactor to bulk insert #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks pretty reasonable. I have a few questions re error handling and some internal api suggestions
|
Oh, there's a couple of checklist things that aren't checked or marked as N/A, missed that |
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions on the new stuff
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple questions on the new stuff
|
Well that's weird, not quite sure what happened there |
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a look at the newer changes
|
Working on tests and coverage |
|
This pull request introduces 1 alert when merging 9be3578 into 3150622 - view on LGTM.com new alerts:
|
| ) | ||
| except Exception as e: | ||
| logging.info( | ||
| logging.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed extra info from logs
| def test_status_change(self): | ||
|
|
||
| with self.assertRaisesRegexp( | ||
| with self.assertRaisesRegex( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing warning
| "hex string" | ||
| ) | ||
| with self.assertRaisesRegexp(RetryFailureException, errmsg): | ||
| with self.assertRaisesRegex(RetryFailureException, errmsg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing warning
| from lib.execution_engine2.exceptions import InvalidStatusTransitionException | ||
| from lib.execution_engine2.sdk.SDKMethodRunner import SDKMethodRunner | ||
| from lib.execution_engine2.utils.CondorTuples import SubmissionInfo | ||
| from execution_engine2.db.models.models import Job, Status, TerminatedCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing imports
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code seems fine but the tests aren't passing, so I assume there's more work there to do and haven't looked at them yet
|
Tests are done, not sure why that one failed all of a sudden on github actions. It's been failing locally on my machine for months but not on github actions. It was a bad test because the underlying functionality is actually wrong and the test is flaky depending on where you run it |
|
Interesting, the tests passed consistently on my machine when I was doing ee2 work. |
|
Note to self: New behaviors are
|
|
Further note to self: there are API to DB integration tests that exercise |
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few minor changes and some unit tests that I think should be pretty easy
| yield self.me_connection | ||
|
|
||
| def insert_jobs(self, jobs_to_insert: List[Job]) -> List[ObjectId]: | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There aren't any unit tests for this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, wrote a basic test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It tests that the method returns job IDs, but not that the jobs are actually correctly inserted to the DB. If this were me writing the tests I'd retrieve the jobs either via the MongoUtil API or directly from mongo and ensure the data was what I expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, added that, but not quite sure if that's what you had in mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is, except the problem is that equality on Job objects only tests the _id, not any other fields. So the insert method could completely trash the incoming Job object and save it and the test will still pass. I'd update to use the assert_job_equal method from EE2RunJob_test.py (maybe that should be moved to a utility class at some point)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright well how about using
for i, retrieved_job in enumerate(retrieved_jobs):
assert jobs_to_insert[i].to_json() == retrieved_job.to_json()
assert jobs_to_insert[i].to_mongo() == retrieved_job.to_mongo()
assert jobs_to_insert[i].to_dbref() == retrieved_job.to_dbref()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bah, realized that the modify command isn't updating the "updated" timestamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this test in a new PR #416
MrCreosote
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description of PR purpose/changes
Testing Instructions
Dev Checklist:
Updating Version and Release Notes (if applicable)